package rattlesnake.callback.util;

import com.google.gson.Gson;
import org.springframework.util.StringUtils;
import rattlesnake.callback.modle.vo.ResponseVo;

/**
 * Created by liuxin on 17/1/12.
 * 返回快照信息，对Order服务返回的Json信息，转换
 */
public class JsonUtil {
    private static final Gson gson = new Gson();

    /**
     * 得到code
     *
     * @param resBoby
     * @return
     */
    public static ResponseVo getResponseVo(String resBoby) {
        ResponseVo orderData = null;
        if (!StringUtils.isEmpty(resBoby)) {

            orderData = gson.fromJson(resBoby, ResponseVo.class);//json转Resvo取到data
        } else {
            orderData = new ResponseVo(-1, "品类服务异常");
        }
        return orderData;
    }
}
